package com.bcht.demo.spring.controller;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@ControllerAdvice
public class GolbalException {

    @ExceptionHandler(RuntimeException.class)
    @ResponseBody
    public Map /*ModelAndView*/ exceptionHandle(){
         Map<String,Object> result = new HashMap<>();
         result.put("code","500");
         result.put("msg","运行出错！！请稍等！！");
        return  result;
    }
}
